#include <iostream>

class Pool
{
private:
	size_t RowCount;
	const size_t blockSize;
	const size_t elemSize;
	char ** pool;
	void * head;
	bool traceFlag;

	// Disable the copy and assign operators
	Pool & operator = (const Pool &);
	Pool (const Pool&);

	void grow();

	static void putInBucket(char* src, char* dest)
	{
		char** loc = reinterpret_cast<char**>(src);
		*loc = dest;
	}
	static char* getFromBucket(char* head)
	{
		char** loc = reinterpret_cast<char**>(head);
		return *loc;
	}

public:
	Pool(size_t elemSize, size_t blockSize, bool traceFlag);
	~Pool();
	void* allocate(); 
	void deallocate(void*);
};